In Go, collections are fundamentally groups of items of the same type, organized for efficient access. The "Cargo Bay" represents our need to manage bulk data under a single identifier rather than separate variables.
1. The Composite Literal
A composite literal is a concise syntax to initialize any composite type with the values you want. It allows you to declare and initialize an array in a single step using the syntax: type{value1, value2, ...}.
2. Zero-Based Navigation
Arrays are indexed starting at 0. A collection of 8 planets is accessed using indices 0 through 7. Accessing an index outside this range results in a compile-time error or a runtime panic.
Figure 16.1: Planets with Indices 0-7
TERMINAL
bash — 80x24
> Ready. Click "Run" to execute.
>